home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Programmer Disk
/
The Programmer Disk (Microforum).iso
/
xpro
/
c2
/
pro4
/
kheader.c
< prev
next >
Wrap
Text File
|
1986-05-08
|
2KB
|
110 lines
/* «RM120»«PL99999»«TS4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76» */
#include <stdio.h>
#define EXTERN extern
#include <typedef.h>
void SetHeaderOn()
{
HeaderGlb = TRUE;
}
void SetHeaderOff()
{
HeaderGlb = FALSE;
}
void SetHeaderToTop()
{
TopGlb = TRUE;
}
void SetHeaderToBottom()
{
TopGlb = FALSE;
}
void RemoveHeader(i)
int i;
{
if ((1 <= i) && (MaxWindowsGlb >= i)) {
window[i].drawn = FALSE;
window[i].top = TRUE;
*(window[i].header) = EOS;
}
else
error(22, 2);
}
void DefineHeader(i, hdr)
int i;
char *hdr;
{
if ((1 <= i) && (i <= MaxWindowsGlb))
strcpy(window[i].header, hdr);
else
error(3,2);
}
static void DrawHeaderBackground(y1, y2, xl1, xl2)
int y1, y2;
int xl1, xl2;
{
int i;
for (i = y1; i <= y2; i++)
DrawStraight(xl1 , xl2, i);
}
void DrawHeader(xl1, xl2)
int xl1, xl2;
{
int Y1Hdr, Y2Hdr, yl1, yl2;
if (window[WindowNdxGlb].drawn) {
if (window[WindowNdxGlb].top) {
ReDefineWindow(WindowNdxGlb, X1RefGlb, Y1RefGlb - HeaderSizeGlb,
X2RefGlb, Y2RefGlb);
SelectWindow(WindowNdxGlb);
}
else {
ReDefineWindow(WindowNdxGlb, X1RefGlb, Y1RefGlb, X2RefGlb,
Y2RefGlb + HeaderSizeGlb);
SelectWindow(WindowNdxGlb);
}
}
if (TopGlb) {
yl1 = Y1RefGlb+HeaderSizeGlb;
yl2 = Y2RefGlb;
Y1Hdr = Y1RefGlb;
Y2Hdr = Y1RefGlb+HeaderSizeGlb-1;
}
else {
yl1 = Y1RefGlb;
yl2 = Y2RefGlb-HeaderSizeGlb;
Y1Hdr = Y2RefGlb-HeaderSizeGlb+1;
Y2Hdr = Y2RefGlb;
}
window[WindowNdxGlb].top = TopGlb;
ReDefineWindow(WindowNdxGlb,X1RefGlb,yl1,X2RefGlb,yl2);
SelectWindow(WindowNdxGlb);
DrawHeaderBackground(Y1Hdr, Y2Hdr, xl1, xl2);
ColorGlb = 255-ColorGlb;
DrawText(xl1+2+(xl2-xl1-strlen(window[WindowNdxGlb].header)*6) / 2,
Y1Hdr+3,1,window[WindowNdxGlb].header);
DrawSquare((double)xl1, (double)Y1Hdr, (double)xl2, (double)Y2Hdr,
FALSE);
ColorGlb = 255-ColorGlb;
DrawSquare((double)xl1, (double)Y1RefGlb, (double)xl2,
(double)Y2RefGlb, FALSE);
window[WindowNdxGlb].drawn = TRUE;
}